package com.yang.service.api;

import com.yang.service.model.dto.post.AddrPostDTO;
import com.yang.service.model.dto.put.AddrPutDTO;
import com.yang.service.model.vo.AddrVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * Created by xin7k
 * Date: 2019/12/17 0017
 */
@FeignClient(name = "${zhy.endpoint.basedata}")
public interface AddrService {
    /**
     * 保存
     */
    @PostMapping("addr")
    String save(@RequestBody @Valid AddrPostDTO dto, @RequestParam(value = "userId") String userId);

    /*
    * 根据用户Id查询所有
    * */
    @GetMapping("addr/list")
    List<AddrVo> selectList(@RequestParam(value = "userId") String userId);

    /**
     * 根据ID更新
     */
    @PutMapping("addr/{id}")
    boolean update(@PathVariable("id") String id, @RequestBody @Valid AddrPutDTO dto);


    /**
     * 根据ID删除
     */
    @DeleteMapping("addr/{id}")
    boolean deleteById(@PathVariable("id") String id);


    /**
     * 根据ID批量删除
     */
    @DeleteMapping("addr/batch")
    boolean deleteBatch(@RequestBody List<String> ids);
}
